import time
import  unittest
import app
from script.test_category import TestCategory
from script.test_index import TestIndex
from script.test_order import TestOrder
from script.test_user import Test_user
from htmltestreport import HTMLTestReport
import  webbrowser

suite = unittest.TestSuite()
testLoader = unittest.TestLoader()

suite.addTest(testLoader.loadTestsFromTestCase(TestIndex))
suite.addTest(testLoader.loadTestsFromTestCase(Test_user))
suite.addTest(testLoader.loadTestsFromTestCase(TestCategory))
suite.addTest(testLoader.loadTestsFromTestCase(TestOrder))

# report_file = app.BASE_DIR+'/report/test_{}.html'.format(time.strftime("%Y-%m-%d"))
report_file = app.BASE_DIR+'/report/test.html'
runner = HTMLTestReport(report_file,'测试用例','V1.0')
runner.run(suite)
webbrowser.open(report_file)
